<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Document</title>
        <style>
            div {
                position: relative; /* 参照物 */
                width: 300px;
                background-color: rgba(0, 0, 0, 0.3);
                padding: 10px;
            }
            input {
                width: 260px; /* 300-20*2 */
                padding: 10px 20px;
                border: none;
            }
            img {
                position: absolute;
                top: 14px;
                right: 40px;
            }
            p {
                margin: 0;
                font-size: 12px;
                color: red;
            }
        </style>
    </head>
    <body>
        <div>
            <!-- input中的placeholder属性用来设置默认显示的内容 -->
            <input type="text" placeholder="请输入用户名" />
            <img
                src="http://doc.canglaoshi.org/tstore_v1/images/login/yhm.png"
                alt=""
            />
            <p>用户名不能为空!</p>
        </div>
    </body>
</html>
